<?php
class productLevelComponent extends sfComponent{
	public function execute($request){
		$data['levels'] = ProductLevels::getDataListFrontEnd();
		$data['products']				= Products::getDataListFrontEnd(array('filter_sort_order' => Products::FILTER_SORT_ATTRIBUTE_HOT), array('page' => 1, 'limit' => sfConfig::get('app_product_right_limit')));
		$data['cate_id']	= -1;//$request->getParameter('cate_id', -1);
		
		$data['level_id']	= $request->getParameter('level_id', -1);
		if(intval($data['level_id']) == -1){
			$pr = Products::getDataByIdFrontEnd($request->getParameter('id', -1));
			if(count($pr)){
				$data['level_id'] = intval($pr['level_id']);
			}
		}
		#print_r($data); return sfView::NONE;
		$this->setVar('data', $data);
	}
}